#include <memory>
#include <GL/glew.h>
#include "framework/logger.h"
#include "framework/input.h"
#include "renderer/context_wgl.h"

class TestController : public cyb::IMouseListener
{
public:
	virtual bool OnMouseMove( int32_t x, int32_t y ) { return true; }
	
	virtual bool OnMouseButtonDown( int32_t x, int32_t y, cyb::MouseButton::Enum button )
	{
		CYB_DEBUG( "OnButtonDown: Button: ", button, " ( ", x, "x", y, " )"  );
		return true;
	}

	virtual bool OnMouseButtonUp( int32_t x, int32_t y, cyb::MouseButton::Enum button )
	{
		CYB_DEBUG( "OnButtonUp: Button: ", button, " ( ", x, "x", y, " )"  );
		return true;
	}
};

int main( int argc, char* argv[] )
{
	auto window = std::make_unique<cyb::Context_Win>( cyb::Dimension2i( 500, 500 ) );
	window->Title( "Example 02: Context" );

	auto inputListener = std::make_shared<cyb::InputListener>( nullptr, std::make_shared<TestController>() );
	window->AddInputListener( inputListener );
	
	glClearColor( 0.56f, 0.56f, 0.63f, 1.0f );
	while ( window->IsOpen() )
	{
		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
		window->ProcessEvents();

		window->SwapBuffers();
	}

	window.release();
	return 0;
}